package com.nutransit;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.MenuItem;
import android.view.Window;
import android.webkit.WebView;

import com.nutransit.commoncode.Webservice_parametrs;

public class Activity_WebView extends ActionBarActivity implements Webservice_parametrs
{
	private String strPageId;

	private Context context;
	
	private ActionBar actionBar;
	private WebView wv_Content;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		if(Build.VERSION.SDK_INT>=11)
			getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
		setContentView(R.layout.fragment_webview);

		init_var();
	}

	private void init_var()
	{
		context = Activity_WebView.this;
		
		actionBar = getSupportActionBar();
		actionBar.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
		actionBar.setDisplayHomeAsUpEnabled(true);
		actionBar.setTitle("");
		actionBar.setIcon(new ColorDrawable(android.R.color.transparent));
		actionBar.setDisplayShowHomeEnabled(true);
		
		Intent intent = getIntent();
		strPageId = intent.hasExtra(TAG_pageid)?intent.getStringExtra(TAG_pageid):null;
		System.out.println("strPageId: "+strPageId);
		
		wv_Content = (WebView) findViewById(R.id.wv_Content);
		wv_Content.loadUrl(URL_ABOUT_US);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem menuItem)
	{
		switch (menuItem.getItemId())
		{
			case android.R.id.home:
				onBackPressed();
				break;
	
			default:
				break;
		}
		return super.onOptionsItemSelected(menuItem);
	}

	@Override
	public void onBackPressed()
	{
		Activity_WebView.this.finish();
		super.onBackPressed();
	}
}
